#include<stdio.h>
int main(){
	int BJT,UTC,hour2;
	scanf("%d",&BJT);
	int hour1=BJT/100;
	int minute=BJT%100;
	if(hour1>=8) hour2=hour1-8;
	else hour2=hour1-8+24;
	UTC=hour2*100+minute;
	printf("%d",UTC);
	return 0;
}
